<script>
function insertonerow(){
    $soluonghd = document.getElementById("slhd").value;
				
			
    document.getElementById("laphd-tbl").insertRow(-1).innerHTML = "";
    
}
$(function() {

                $("#ngay").datepicker();
            }); 
function suahoidong($i){
    
    
    $hdcu = document.getElementById('sohd').value;
    if($hdcu != ''){
    document.getElementById('hoidongan'+$hdcu).style.display='none';
    }
    $(function() {
        var ngay = "#ngayan"+$i;
        $(ngay).datepicker();
    });
    document.getElementById('sohd').value=$i;
    document.getElementById('hoidongan'+$i).style.display='table-row';
}  
function xoahoidong($id){
    if(confirm('Bạn có chắc muốn xóa?')){
        window.location.href = "index.php?muc=tochucthi&modul=laphoidongthi&xoa&mahd="+$id;
    }
}
function huysua($i){
   document.getElementById('hoidongan'+$i).style.display='none';
   document.getElementById('sohd').value = '';
}
</script>
<div class="content-box"><!-- Start Content Box -->
	<div class="content-box-header">
		<h3>Lập hội đồng thi</h3>
	</div>
	<!-- main content -->
	<div class="content-box-content">
	
	
	<form method="POST" id="formnoidung" name="dulieu">

    <table>
        <tr>
            <td colspan="4"><b>Lập hội đồng thi</b></td>
            </tr>

			<tr class="alt-row">
                <td>
					<b>Đơn vị</b>
					
					<select name="donvi" id="donvi">
					
						{foreach from=$ds_dv item=dv}
						
							<option value="{$dv->getma_donvi()}">{$dv->getten_donvi()}</option>
						{/foreach}    
						</select>

				</td>
				
				<td>
					<b>Học vụ</b>
					<select name="hocvu" id="hocvu">
						{foreach from=$ds_dvhv item=dvhv}
						<option value="{$dvhv->getma_donvihocvu()}">{$dvhv->getma_donvihocvu()}</option>
						{/foreach}
					</select>
 
				</td>
				
				<td><b>Ngày quyết định</b> <input class="medium-input" name="ngay" id="ngay" value="{date('d/m/Y')}" /></td>
            <td><input type="hidden" id="slhd" value="1" />
                <input class="button" type="submit" name="luu" value="Lưu"/></td>
        </tr>
    </table>
      </form>
	<br /> 
        <form method="POST" action="">
            <input type="hidden" name="sohd" id="sohd" value="" />
            <table id="laphd-tbl">
            <tbody>
            <tr><td colspan="6"><b>Danh sách hội đồng</b></td></tr>
            <tr>
                <td><b>STT</b></td>
                <td><b>Tên hội đồng</b></td>
                <td><b>Học vụ</b></td>
                <td><b>Thời gian</b></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
            </tr>
            {$i=1}
            {foreach from=$listhdthi item=hdthi}
                <tr>
                <td class="cangiua">{$i}</td>
                <td class="td-265">{$hdthi['ten_donvi']}</td>
                <td class="td-100">{$hdthi['ma_donvihocvu']}</td>
                <td class="td-100">{$hdthi['thoigian_hoidong']}</td>
                <td><img src="../php/images/edit.png" onclick="suahoidong({$i});"  width="20px" id="{$hdthi['ma_hoidong']}" /></td>
                <td><img src="../php/images/del.png" onclick="xoahoidong('{$hdthi['ma_hoidong']}');" width="20px" id="{$hdthi['ma_hoidong']}" /></td>
                </tr>
                
                <tr id="hoidongan{$i}" style="display:none">
                <td></td>
                <td class="td-265"><select name="donvian{$i}" id="donvian{$i}">
					{foreach from=$ds_dv item=dv}
						<option {if $dv->getma_donvi()==$hdthi['ma_donvi']} selected="" {/if} value="{$dv->getma_donvi()}">{$dv->getten_donvi()}</option>
					{/foreach}    
					</select>
                </td>               
                <td class="td-100"><select name="hocvuan{$i}" id="hocvuan{$i}">
						{foreach from=$ds_dvhv item=dvhv}
						<option {if $dvhv->getma_donvihocvu()==$hdthi['ma_donvihocvu']} selected="" {/if} value="{$dvhv->getma_donvihocvu()}">{$dvhv->getma_donvihocvu()}</option>
						{/foreach}
					</select>
                </td>
                <td class="td-100"><input class="medium-input" name="ngayan{$i}" id="ngayan{$i}" value="{$hdthi['thoigian_hoidong']}" /></td>
                <td><input type="hidden" name="hoidongan{$i}" value="{$hdthi['ma_hoidong']}" />
                    <input class="button" type="submit" name="sua" value="Lưu" /></td>
                <td><input class="button" onclick="huysua('{$i}');" type="button" value="Hủy"/></td>
                </tr>
                {$i=$i+1}
            {/foreach}
           
            
                
                 </tbody>
    </table>
        </form>

	
	<!-- End main content -->
</div>